<?php
/*****************
*原Support模版 sql字段类型功能实现.
*创建日期:2012-4-24
*作者：tjx
******************/

include_once('public_function.php');
include_once('public_support_function.php');

class PublicSupport  extends PublicFunction  {
	
	function __construct($arr = NULL) {
		
	}
	
	/**
	* 获取某个产品的分类信息
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function productFaqTypeInfo($get = array()) {
		
		$ws_id =  (int) $get['产品ID'] ;
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$product_id   = $this->publicProductId($get);
		
		$sql = "SELECT version_id 
				FROM version 
				WHERE product_id =  {$product_id}  
				ORDER BY  version_name DESC ";
		$sql = "SELECT f.type_id 
				FROM faq_info_new f, ({$sql}) AS v
				WHERE FIND_IN_SET(v.version_id, f.version_id) AND !FIND_IN_SET( f.type_id, '2,4,7,8' ) AND web_type = {$webInfo['web_fage']}
				GROUP BY f.type_id ";
		$sql = "SELECT t.type_id, t.type_name, tem.url
				FROM ({$sql}) a 
				LEFT JOIN faq_type t  ON a.type_id = t.type_id
				LEFT JOIN  Table_{$webInfo['how_tos_category_list']['table']} tem ON tem.Field_{$webInfo['how_tos_category_list']['tId']} = t.type_id 
				WHERE  tem.Field_{$webInfo['how_tos_category_list']['pId']} = {$ws_id} AND t.type = 'developer'";
		$rows = $GLOBALS['db']->getAll($sql);
		return array('rows' => $rows, 'webInfo' => $webInfo);
	}
	
	/**
	* 获取公共产品ID
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function publicProductId($get = array()) {
		
		$ws_id =  (int) $get['产品ID'] ;
		
		$sql = "SELECT won_product_id 
				FROM won_product 
				WHERE id = {$ws_id} AND won_product_delete = 0";
		return  $GLOBALS['db']->getOne($sql);
	}
	/**
	* 得到推荐分类组合
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function recommendCategory($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT re_category_id 
				FROM faq_index_recommend 
				WHERE web_type = '{$webInfo['web_fage']}'";
		$re_category_str = $GLOBALS['db']->getOne($sql);
		
		$sql = 'SELECT type_name 
				FROM faq_type 
				WHERE FIND_IN_SET(type_id,"'.$re_category_str.'")';
		
		return $sql;
	}
	
	/**
	* 推荐Order文章
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function recommendOrderArticle($get = array() ) {
	
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT new.sub_title ,new.id,new.type_id 
				FROM faq_operation_types AS o_types 
				LEFT JOIN faq_info_new AS new ON o_types.id = new.id 
				WHERE o_types.web_type = '{$webInfo['web_fage']}' AND o_types.is_recommend_index = 1 AND new.web_type = '{$webInfo['web_fage']}' 
				ORDER BY new.update_time DESC LIMIT '{$get['limit']}'";
		
		return array('sql' => $sql, 'webInfo' => $webInfo);
		
	}
	
	/**
	* 得到分类相关FAQ信息
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function categoryRelatedFaq($get = array() ) {
		
		$str = '';
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT re_category_id 
				FROM faq_index_recommend 
				WHERE web_type = '{$webInfo['web_fage']}'";
		$re_category_str = $GLOBALS['db']->getOne($sql);
		
		$cate_row =  explode(',', $re_category_str);
		
		return array('cate_row' => $cate_row, 'webInfo' => $webInfo);
	}
	
	
	/**
	* 得到推荐产品组合
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function recommendProducts($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT re_product_id 
				FROM faq_index_recommend 
				WHERE web_type = '{$webInfo['web_fage']}'";

		$re_product_str = $GLOBALS['db']->getOne($sql);
		$limit='';
		if($get['limit']>0){
			$limit = " LIMIT {$get['limit']}";
		}
		$sql = "SELECT p.product_id ,p.product_name , p.product_box_middle,tab.url 
				FROM product p 
				LEFT JOIN won_product won_p ON won_p.won_product_id = p.product_id 
				LEFT JOIN Table_{$webInfo['products_info']['table']} tab ON tab.Field_{$webInfo['products_info']['pId']} = won_p.id 
				WHERE FIND_IN_SET(won_p.id,'{$re_product_str}') AND web_type = '{$webInfo['web_fage']}' $limit";
		
		return array('sql' => $sql, 'webInfo' => $webInfo);
		
	}
	
	/**
	* 得到Order分类列表
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function  orderCategoryList($get = array() ) {
	
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT type_id,type_name,tem.url 
				FROM faq_type 
				LEFT JOIN Table_{$webInfo['order_category']['table']} AS tem ON tem.Field_{$webInfo['order_category']['categoryName']} = faq_type.type_name 
				WHERE FIND_IN_SET(faq_type.type_id, '7,1,4,2,8') 
				ORDER BY FIND_IN_SET(faq_type.type_id, '7,1,4,2,8') ";
		
		return array('sql' => $sql, 'webInfo' => $webInfo);
		
		
	}

	/**
	* 得到具体分类相关FAQ
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function  definiteCategoryRelatedFaq($get = array() ) {
		
		$type_name = trim($get["FAQ分类名称"]); //得到faq分类
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT faq_info_new.title,tem.url 
				FROM faq_info_new 
				LEFT JOIN (
				    SELECT is_important ,id 
				    FROM faq_operation_types 
				    WHERE web_type = '{$webInfo['web_fage']}' 
				)  AS o_types ON o_types.id = faq_info_new.id 
				LEFT JOIN Table_{$webInfo['order_info']['table']} AS tem ON tem.Field_{$webInfo['order_info']['temKey']} = faq_info_new.id 
				LEFT JOIN faq_type ON faq_info_new.type_id = faq_type.type_id 
				WHERE faq_type.type_name = '{$type_name}' AND faq_info_new.web_type = '{$webInfo['web_fage']}' 
				ORDER BY o_types.is_important DESC ";
		return array('sql' => $sql, 'webInfo' => $webInfo);
		
		
	}
	
	/**
	* 得到Order_Support相关分类
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function  relatedCategory($get = array() ) {
		
		$type_name = trim($get["FAQ分类名称"]); //得到faq分类
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT Field_{$webInfo['order_category']['categoryName']},Field_{$webInfo['order_category']['temDescription']},url 
				FROM Table_{$webInfo['order_category']['table']} 
				WHERE Field_{$webInfo['order_category']['categoryName']} != '{$type_name}' LIMIT 3 ";
		return array('sql' => $sql, 'webInfo' => $webInfo);
		
		
	}
	
	/**
	* 得到Order_Support具体Order分类列表
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function  definiteOrderCategoryList($get = array() ) {

		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT type_id,type_name,tem.url 
				FROM faq_type 
				LEFT JOIN Table_{$webInfo['order_category']['table']} AS tem ON tem.Field_{$webInfo['order_category']['categoryName']} = faq_type.type_name 
				WHERE FIND_IN_SET(faq_type.type_id, '7,1,4,2,8') 
				ORDER BY FIND_IN_SET(faq_type.type_id, '7,1,4,2,8') ";
		
		return array('sql' => $sql, 'webInfo' => $webInfo);
	
		
	}

	/**
	* 得到Order文章内容
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function articleContent($get = array() ) {
		
		$a_id = (int) $get["文章ID"];
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$a_type = empty($get["文章类型"]) ? '' : trim($get["文章类型"]);
		
		$table = 'faq_info_new';
		$content_field = 'contents';
		
		if ($a_type == '在线帮助文章') {
			$table = 'online_help';
			$content_field = 'content';
		}

		$sql =  "SELECT {$content_field} 
					FROM {$table}
					WHERE id = {$a_id} AND web_type = '{$webInfo['web_fage']}' ";
		$contents = $GLOBALS['db']->getOne($sql);
		
		return  $contents;
		
	}
	
	/**
	* 得到Order_Support文章   Order文章分类列表
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function  articleOrderCategoryList($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$a_id = (int) $get["文章ID"];
		
		$sql =  "SELECT type_id 
				FROM faq_info_new 
				WHERE id = {$a_id} AND web_type = '{$webInfo['web_fage']}' ";
		$type_id  = $GLOBALS['db']->getOne($sql);
		
		$sql = "SELECT type_id,type_name,tem.url 
				FROM faq_type 
				LEFT JOIN Table_{$webInfo['order_category']['table']} AS tem ON tem.Field_{$webInfo['order_category']['categoryName']} = faq_type.type_name 
				WHERE FIND_IN_SET(faq_type.type_id, '2,4,7,8') ";
		
		return array('sql' => $sql, 'webInfo' => $webInfo, 'type_id' => $type_id);
		
	}
	
	/**
	* 得到Order_Support文章    文章相关分类链接
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function articleCategoryHref($get = array() ) {
		
		$a_id = (int) $get["文章ID"];
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT tem.url,faq_type.type_name 
				FROM faq_info_new,faq_type,Table_{$webInfo['order_category']['table']} AS tem 
				WHERE faq_info_new.type_id = faq_type.type_id AND faq_type.type_name = tem.Field_{$webInfo['order_category']['categoryName']} AND faq_info_new.id = {$a_id} " ;
		
		return array('sql' => $sql, 'webInfo' => $webInfo);
	
	}
	
	/**
	* 得到  文章发布时间
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getArticlePubTime($get = array() ) {
		
		$str = '';
		$a_id = (int) $get["文章ID"];
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$a_type = empty($get["文章类型"]) ? '' : trim($get["文章类型"]);
		
		$table = $a_type == '在线帮助文章' ? 'online_help' : 'faq_info_new' ;
		
		$sql = "SELECT released 
					FROM {$table} 
					WHERE id = {$a_id} AND web_type = '{$webInfo['web_fage']}' ";
		$released = $GLOBALS['db']->getOne($sql);
		
		return $released;
	
	}
	
	/**
	* 得到Order_Support文章   对应其他分类Order文章
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function orderOtherCategoryArticle($get = array() ) {
		
		$str = '';
		$a_id = (int) $get["文章ID"];
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息

		$sql =  "SELECT type_id 
				FROM faq_info_new 
				WHERE id = {$a_id} AND web_type = '{$webInfo['web_fage']}' ";
		$type_id = $GLOBALS['db']->getOne($sql);
		
		$sql = "SELECT faq.title,tab.url 
				FROM Table_{$webInfo['order_info']['table']} AS tab  
				LEFT JOIN faq_info_new AS faq  ON tab.Field_{$webInfo['order_info']['temKey']} = faq.id 
				WHERE faq.type_id != '{$type_id}' AND faq.web_type = '{$webInfo['web_fage']}' AND faq.id IN (
				    SELECT id 
				    FROM faq_operation_types 
				    WHERE web_type = '{$webInfo['web_fage']}' AND is_important = 1 ) 
				UNION ALL 
				SELECT faq.title,tab.url 
				FROM Table_{$webInfo['order_info']['table']} AS tab
				LEFT JOIN faq_info_new AS faq   ON tab.Field_{$webInfo['order_info']['temKey']} = faq.id 
				WHERE faq.type_id != '{$type_id}' AND faq.web_type = '{$webInfo['web_fage']}' AND faq.id NOT IN (
				    SELECT id 
				    FROM faq_operation_types 
				    WHERE web_type = '{$webInfo['web_fage']}' AND is_important = 1 ) LIMIT 3 ";
		
		return array('sql' => $sql, 'webInfo' => $webInfo);
		
	}
	
	/**
	* 得到  文章副标题
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getArticleSubtitle($get = array() ) {
		
		$str = '';
		$a_id = (int) $get["文章ID"];
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$a_type = empty($get["文章类型"]) ? '' : trim($get["文章类型"]);
		
		$table = $a_type == '在线帮助文章' ? 'online_help' : 'faq_info_new';
		
		$sql =  "SELECT sub_title 
				FROM {$table} 
				WHERE id = {$a_id} AND web_type = '{$webInfo['web_fage']}' ";
		$sub_title = $GLOBALS['db']->getOne($sql);
		
		return $sub_title = strlen($sub_title) > 65 ? substr($sub_title, 0, 65).'...' : $sub_title;
	
	
	}
	
	/**
	* 得到   所有所有一级分类
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function allOneCategory($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT cat.cat_title,tem.url 
				FROM category cat 
				LEFT JOIN Table_{$webInfo['products_category']['table']} AS tem ON tem.Field_{$webInfo['products_category']['temKey']} = cat.cat_id 
				WHERE cat.cat_type = 2 AND cat.cat_web = '{$webInfo['web_fage']}' AND cat.is_delete = 0 AND cat.cat_series =1 
				ORDER BY cat.sort_order ASC ";
	
		return array('sql' => $sql, 'webInfo' => $webInfo);	
	
	}
	
	/**
	* 得到   所有所有一级分类
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getTwoProductsCategoryHref($get = array() ) {
		
		$url = '';
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$cat_name = trim($get['产品分类名称']);
		
		$sql = "SELECT url 
				FROM Table_{$webInfo['products_category_one']['table']} 
				WHERE Field_{$webInfo['products_category_one']['cName']} = '{$cat_name}' LIMIT 1 ";
		$url =  $GLOBALS['db']->getOne($sql);
		
		if (!empty($url)) {
			$url = url_new_replace($url, $webInfo['url_name'], $webInfo['web_domain']);
		}
		return  $url; 
	
	}
	
	/**
	* 得到   所有所有一级分类
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function definiteAllOneCategory($get = array() ) {

		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息

		$sql = "SELECT cat.cat_title,tem.url ,cat.cat_id 
				FROM category cat 
				LEFT JOIN Table_{$webInfo['products_category']['table']} AS tem ON tem.Field_{$webInfo['products_category']['temKey']} = cat.cat_id 
				WHERE cat.cat_type = 2 AND cat.cat_web = '{$webInfo['web_fage']}' AND cat.is_delete = 0 AND cat.cat_series =1 
				ORDER BY cat.sort_order ASC ";
		
		return array('sql' => $sql, 'webInfo' => $webInfo);	
	
	}
	
	/**
	* 得到   二级分类以及相关产品
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function twoCategoryRelatedProducts($get = array() ) {
		
		$str = '';
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$cat_id = (int) $get['产品分类ID'];
		
		$sql = "SELECT cat_id,cat_title 
				FROM category 
				WHERE FIND_IN_SET({$cat_id}, parent_path) AND cat_type =2 AND cat_web = '{$webInfo['web_fage']}' AND is_delete = 0 AND cat_series = 2 ";
		
		return array('sql' => $sql, 'webInfo' => $webInfo);	
	}
	
		/**
	* 得到具体Order分类相关faq列表和分页信息  生成分页
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function definiteOrderCategoryFaqCreatePage($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$type_name = trim($get['FAQ分类名称']);
		$DirName = dirname($get['url']);
		$dirurl = str_replace('/'.$webInfo['web_domain'].'/httpdocs/','',$DirName);//专题目录名称
		//不预览
		if ($get['do'] != 'view') {
			$dir = DOC_ROOT.'/'.$DirName;
			$template_str = $this->replaceTemplateAndGet($get['tem_style']);
			MakeDir1($dir);//根据路径递归创建文件
			if(!is_dir($dir)){
				$DirName = DOC_ROOT.'/'.$webInfo['web_domain'].'/httpdocs';
			}
		}
		
		$sql = "SELECT * 
				FROM ( (
				SELECT new.id ,new.contents, new.title,tab.url 
				FROM faq_info_new new 
				LEFT JOIN Table_{$webInfo['order_info']['table']} tab ON tab.Field_{$webInfo['order_info']['temKey']} = new.id 
				LEFT JOIN faq_type type ON new.type_id = type.type_id 
				WHERE new.id IN (
				    SELECT id 
				    FROM faq_operation_types 
				    WHERE web_type = '{$webInfo['web_fage']}' AND is_important = 1 ) AND type.type_name = '{$type_name}' AND new.web_type = '{$webInfo['web_fage']}' ) 
				UNION ALL ( 
				SELECT new.id ,new.contents, new.title,tab.url 
				FROM faq_info_new new 
				LEFT JOIN Table_{$webInfo['order_info']['table']} tab ON tab.Field_{$webInfo['order_info']['temKey']} = new.id 
				LEFT JOIN faq_type type ON new.type_id = type.type_id 
				WHERE new.id NOT IN (
				    SELECT id 
				    FROM faq_operation_types 
				    WHERE web_type = '{$webInfo['web_fage']}' AND is_important = 1 ) AND type.type_name = '{$type_name}' AND new.web_type = '{$webInfo['web_fage']}' 
				ORDER BY new.id ) ) newFaq ";
			
		$res = $GLOBALS['db']->query($sql);
		
		$all = array();
		
		while ($row = $GLOBALS['db']->fetch_array($res))  {
			
			$all[] = $row; 
		}
		
		/************************* 全部 ********************************************/
		$total = count($all);
		$max_page = ceil($total / 10);
		
		return array('total' => $total, 'max_page' => $max_page, 'dirurl' => $dirurl, 'dir' => $dir,
					 'template_str' => $template_str, 'all' => $all, 'webInfo' => $webInfo);	
	}
	
	
	
	
	/**
	* 得到Products-Support-TroubleshootingFAQ   生成分页
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function howTosCreatePage($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$DirName = dirname($get['url']);
		$dirurl = str_replace('/'.$webInfo['web_domain'].'/httpdocs/', '', $DirName);//专题目录名称
		//不预览
		if ($get['do'] != 'view') {
			
			$dir = DOC_ROOT.'/'.$DirName;
			$template_str = $this->replaceTemplateAndGet($get['tem_style']);
			MakeDir1($dir);//根据路径递归创建文件
			if (!is_dir($dir)) {
				$DirName = DOC_ROOT.'/'.$webInfo['web_domain'].'/httpdocs';
			}
		}
		
		$sql = "SELECT faq.title,faq.description,faq.id,tab.url,faq.contents 
				FROM faq_info_new AS faq 
				LEFT JOIN Table_{$webInfo['faq_info']['table']} AS tab ON tab.Field_{$webInfo['faq_info']['temKey']} = faq.id 
				WHERE faq.type_id = 6 AND faq.id IN (
				    SELECT id 
				    FROM faq_operation_types 
				    WHERE web_type = '{$webInfo['web_fage']}' AND is_important = 1 ) AND faq.web_type = '{$webInfo['web_fage']}' 
				UNION ALL 
				SELECT faq.title,faq.description,faq.id,tab.url,faq.contents 
				FROM faq_info_new AS faq 
				LEFT JOIN Table_{$webInfo['faq_info']['table']} AS tab ON tab.Field_{$webInfo['faq_info']['temKey']} = faq.id 
				WHERE faq.type_id = 6 AND faq.id NOT IN (
				    SELECT id 
				    FROM faq_operation_types 
				    WHERE web_type = '{$webInfo['web_fage']}' AND is_important = 1 ) AND faq.web_type = '{$webInfo['web_fage']}' ";
		$res = $GLOBALS['db']->query($sql);
		
		$all = array();
		while ($row = $GLOBALS['db']->fetch_array($res)) {
			$all[] = $row; 
		}
		/************************* 全部 ********************************************/
		$total = count($all);
		$max_page = ceil($total / 10);
		
		return array('total' => $total, 'max_page' => $max_page, 'dirurl' => $dirurl,
					 'dir' => $dir, 'template_str' => $template_str, 'all' => $all, 'webInfo' => $webInfo);	
		
		
	}
	
	/**
	* 得到在线帮助 生成分页
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function onHelpCreatePage($get = array()) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$DirName = dirname($get['url']);
		$dirurl = str_replace('/'.$webInfo['web_domain'].'/httpdocs/', '', $DirName);
		//预览
		if ($get['do'] != 'view') {
			$dir = DOC_ROOT.'/'.$DirName;
			$template_str = $this->replaceTemplateAndGet($get['tem_style']);
			
			MakeDir1($dir);//根据路径递归创建文件
			if (!is_dir($dir)) {
				$DirName = DOC_ROOT.'/'.$webInfo['web_domain'].'/httpdocs';
			}
		}
		
		$sql = "SELECT online_help.title,online_help.description,tem.url 
				FROM online_help 
				LEFT JOIN Table_{$webInfo['products_help_info']['table']} AS tem   ON tem.Field_{$webInfo['products_help_info']['temHelpId']} = online_help.id 
				WHERE online_help.is_video = 0 AND online_help.web_type = '{$webInfo['web_fage']}'
				ORDER BY online_help.id DESC ";
		$res = $GLOBALS['db']->query($sql);
		
		$all = array();
		while ($row = $GLOBALS['db']->fetch_array($res)) {
			
			$all[] = $row; 
		}
		/************************* 全部 ********************************************/
		$total = count($all);
		$max_page = ceil($total / 10);
		
		return array('total' => $total, 'max_page' => $max_page, 'dirurl' => $dirurl, 'dir' => $dir,
		 'template_str' => $template_str, 'all' => $all, 'webInfo' => $webInfo);
	}

	/**
	* 得到在线帮助 生成分页
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function downloadCreatePage($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$DirName = dirname($get['url']);
		$dirurl = str_replace('/'.$webInfo['web_domain'].'/httpdocs/','',$DirName);
		//预览
		if ($get['do'] != 'view') {
			$template_str = $this->replaceTemplateAndGet($get['tem_style']);
			$dir = DOC_ROOT.'/'.$DirName;
			
			MakeDir1($dir);//根据路径递归创建文件
			if (!is_dir($dir)) {
				$DirName = DOC_ROOT.'/'.$webInfo['web_domain'].'/httpdocs';
			}
		}
		
		$orderBy = ' ORDER BY  won_p.id DESC  ';
		if ($get['web_type'] == 'iskysoft') {
			$orderBy = ' ORDER BY  won_p.id ASC   ';
		}
		
		$sql = "SELECT v.download_url,v.version_name,p.product_name,p.product_support_intro,won_p.id 
				FROM won_product won_p 
				LEFT JOIN product p ON won_p.won_product_id = p.product_id 
				LEFT JOIN version v ON v.product_cbs_id = p.product_cbsid 
				WHERE v.is_sale = 1 AND (p.product_type = 1 OR p.product_isfree = 1 ) {$webInfo['products_category']['whereRelatedProducts']} AND won_p.won_product_delete = 0 {$orderBy} ";		
	
		$res = $GLOBALS['db']->query($sql);
		
		$all = array();
		while ($row = $GLOBALS['db']->fetch_array($res)) {
			
			$sql = "SELECT url 
					FROM Table_{$webInfo['products_info']['table']} 
					WHERE Field_{$webInfo['products_info']['pId']} = '{$row['id']}' ";
			$url = $GLOBALS['db']->getOne($sql);
			
			if (!empty($url)) {
				$row['p_url'] = url_new_replace($url, $webInfo['url_type'], $webInfo['web_domain']);
				$all[] = $row; 
			}
		}
		/************************* 全部 ********************************************/
		$total = count($all);
		$max_page = ceil($total / 10);
		
		return array('total' => $total, 'max_page' => $max_page, 'dirurl' => $dirurl, 'dir' => $dir,
					  'template_str' => $template_str, 'all' => $all, 'webInfo' => $webInfo);
	}
	
	/**
	* 得到产品HowTos 生成分页
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function productHowTosCreatePage($get = array() ) {
	
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$ws_id =  (int) $get['产品ID'];
		$all = $data = array();
		$DirName = dirname($get['url']);
		$dir = DOC_ROOT.'/'.$DirName;
		//不等于预览
		if ($get['do'] != 'view') {
			
			$template_str = $this->replaceTemplateAndGet($get['tem_style']);
			$dirurl = str_replace('/'.$webInfo['web_domain'].'/httpdocs/', '', $DirName);
			
			MakeDir1($dir);//根据路径递归创建文件
			if (!is_dir($dir)) {
				$DirName = DOC_ROOT.'/'.$webInfo['web_domain'].'/httpdocs';
			}
		}
		
		$product_id   = $this->publicProductId($get); 
		
		$sql = "SELECT version_id FROM version WHERE product_id =  '{$product_id}'  ORDER BY  version_name DESC ";
		$res = $GLOBALS['db']->query($sql);
		
		$find_str = '0';$sql = '';
		while ($row = $GLOBALS['db']->fetch_array($res)) {
			
			$sql_start = "( SELECT faq_info_new.id,faq_info_new.title,faq_info_new.description,faq_info_new.contents, tem.url,o_types.is_important 
							FROM faq_info_new 
							LEFT JOIN (
							    SELECT is_important ,id 
							    FROM faq_operation_types 
							    WHERE web_type = '{$webInfo['web_fage']}'
							)  AS o_types ON o_types.id = faq_info_new.id 
							LEFT JOIN Table_{$webInfo['faq_info']['table']} tem ON tem.Field_{$webInfo['faq_info']['temKey']} = faq_info_new.id 
							WHERE FIND_IN_SET('{$row['version_id']}', faq_info_new.version_id) AND faq_info_new.type_id = 6 AND faq_info_new.web_type = '{$webInfo['web_fage']}'  
							) ";
			
			
			$sql .= empty($sql) ? $sql_start: ' UNION ALL '.$sql_start;
		}
		
		if (empty($sql)) {
			return '';
		}
		
		$sql = "SELECT * 
				FROM ({$sql}
				)  AS new 
				GROUP BY id 
				ORDER BY is_important DESC ";
		$res = $GLOBALS['db']->query($sql);
		
		while ($row = $GLOBALS['db']->fetch_array($res)) {
			
			if (empty($data[trim($row['title'])])) {
				$data[trim($row['title'])] = trim($row['title']); 
				$all[] = $row;
			}
		}
		unset($data, $row);
		/************************* 全部 ********************************************/
		$total = count($all);
		$max_page = ceil($total / 10);
		
		return array('total' => $total, 'max_page' => $max_page, 'dirurl' => $dirurl, 'dir' => $dir,
					 'template_str' => $template_str, 'all' => $all, 'webInfo' => $webInfo);
		
	}
	
	
	/**
	* 产品HowTosFAQ分类列表和分页信息
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function ProductHowTosCategoryCreatePage($get = array() ) {
	
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$ws_id =  (int) $get['产品ID'];
		$type_id =  (int) $get['FAQ分类ID'];
		$all = $data = array();
		$DirName = dirname($get['url']);
		$dir = DOC_ROOT.'/'.$DirName;
		
		//不等于预览
		if ($get['do'] != 'view') {
			
			$template_str = $this->replaceTemplateAndGet($get['tem_style']);
			$dirurl = str_replace('/'.$webInfo['web_domain'].'/httpdocs/', '', $DirName);
			
			MakeDir1($dir);//根据路径递归创建文件
			if (!is_dir($dir)) {
				$DirName = DOC_ROOT.'/'.$webInfo['web_domain'].'/httpdocs';
			}
		}
		
		$product_id   = $this->publicProductId($get); 
		
		$sql = "SELECT version_id 
				FROM version 
				WHERE product_id =  '{$product_id}'  
				ORDER BY  version_name DESC ";
		$res = $GLOBALS['db']->query($sql);
		
		$find_str = '0';
		$sql = '';
		while ($row = $GLOBALS['db']->fetch_array($res)) {
			
			$sql_start = "( SELECT faq_info_new.id, faq_info_new.type_id, faq_info_new.title, faq_info_new.description, faq_info_new.contents, tem.url, o_types.is_important 
							FROM faq_info_new 
							LEFT JOIN (
							    SELECT is_important ,id 
							    FROM faq_operation_types 
							    WHERE web_type = '{$webInfo['web_fage']}'
							)  AS o_types ON o_types.id = faq_info_new.id 
							LEFT JOIN Table_{$webInfo['faq_info']['table']} tem ON tem.Field_{$webInfo['faq_info']['temKey']} = faq_info_new.id 
							WHERE FIND_IN_SET('{$row['version_id']}', faq_info_new.version_id) AND faq_info_new.type_id = {$type_id} AND faq_info_new.web_type = '{$webInfo['web_fage']}'  
							) ";
			
			
			$sql .= empty($sql) ? $sql_start: ' UNION ALL '.$sql_start;
		}
	
		if ( empty($sql) ) {
			return '';
		}
		
		$sql = "SELECT * 
				FROM ({$sql}
				)  AS new 
				GROUP BY id 
				ORDER BY is_important DESC ";

		$res = $GLOBALS['db']->query($sql);
		
		while ($row = $GLOBALS['db']->fetch_array($res)) {
			
			if (empty($data[trim($row['title'])])) {
				$data[trim($row['title'])] = trim($row['title']); 
				$all[] = $row;
			}
		}
		unset($data, $row);
		/************************* 全部 ********************************************/
		$total = count($all);
		$max_page = ceil($total / 10);
		
		return array('total' => $total, 'max_page' => $max_page, 'dirurl' => $dirurl, 'dir' => $dir,
					 'template_str' => $template_str, 'all' => $all, 'webInfo' => $webInfo);
		
	}
	
	/**
	* 返回模板中只有单个页面的链接
	*
	* @param   int     		 $tableId             模板表自增id
	* @param   string        $urlType             网站名称
	* @param   string        $webDomain           网站域名
	* @param   object        $db   	        	   操作数据库对象
	* @return  array
	*/
	function getSingleHerf($tableId = '', $urlType = '', $webDomain = '', $whereStr = '') {
		
		$sql = "SELECT url FROM Table_{$tableId} {$whereStr} LIMIT  1  ";

		$url = $GLOBALS['db']->getOne($sql);
		
		if (empty($url)) {
			return '';
		} else {
			return url_new_replace($url, $urlType, $webDomain);
		}
	}
	
	/**
	* 返回具体网站的模板字段对应数组
	*
	* @param   string      		 $web_type           网站类型
	* @return  array
	*/
	function getWebInfo($web_type) {
		
		$webType = empty($web_type) ? 'wondershare' : strtolower(trim(htmlspecialchars($web_type)));
		return getTemplateInit($webType);

	}
	
	/**
	* Order分类以及文章列表
	* @param   array      		 $get       字段数组
	* @return  string
	* @return  array
	*/
	function orderCategoryArticleList($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT type_id , type_name 
				FROM faq_type 
				WHERE FIND_IN_SET(type_id,'2,4,7,8') ";
		
		return array('sql' => $sql, 'webInfo' => $webInfo);
		
	}
	
	/**
	*得到四条快捷记录与视频代码
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function  productQuickRecord($get = array() ) {
		
		$ws_id = (int) $get["产品ID"];

		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$product_id   = $this->publicProductId($get); 
		
		//以下是得到产品在线帮助地址
		$sql  = "SELECT url 
				FROM Table_{$webInfo['products_help_info']['table']}
				WHERE Field_{$webInfo['products_help_info']['pId']} = {$ws_id}
				ORDER BY Field_{$webInfo['products_help_info']['temHelpId']} DESC LIMIT 1";
		$help_url = $GLOBALS['db']->getOne($sql);
		
		//以下是得到版本信息 sql
		$sql_v = "SELECT v.download_url,v.version_name ,p.product_support_intro 
				FROM version v 
				LEFT JOIN product p ON v.product_cbs_id = p.product_cbsid 
				WHERE v.product_id = {$product_id} AND v.is_sale = 1 AND (p.product_type = 1 OR p.product_isfree = 1 ) 
				ORDER BY v.version_name DESC LIMIT 1";
		
		//以下是得到产品地址
		$sql = "SELECT url 
				FROM Table_{$webInfo['products']['table']}
				WHERE Field_{$webInfo['products']['pId']} = {$ws_id} ";
		$p_url = $GLOBALS['db']->getOne($sql);
		
		if (empty($p_url) && !empty($webInfo['is_products_single_page'])) {
			
			$sql = "SELECT url 
					FROM Table_{$webInfo['single_products']['table']}
					WHERE Field_{$webInfo['single_products']['defaultKey']} = 1 AND Field_{$webInfo['single_products']['pId']} = {$ws_id} ";
			$p_url = $GLOBALS['db']->getOne($sql);
		}
		
		return array('help_url' =>$help_url, 'sql_v' =>$sql_v, 'p_url' =>$p_url, 'webInfo' => $webInfo);
		
	}

	/**
	* 得到产品相关FAQ文章
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function productRelatedFaqArticle($get = array() ) {
		
		$ws_id =  (int) $get['产品ID'] ;
		$product_name = trim($get["产品名称"]);
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$product_id   = $this->publicProductId($get); 
		
		$sql = "SELECT url 
				FROM Table_{$webInfo['products_howtos_info']['table']}
				WHERE Field_{$webInfo['products_howtos_info']['pId']} = {$ws_id} LIMIT 1 ";
		$moreUrl = url_new_replace($GLOBALS['db']->getOne($sql), $webInfo['url_type'], $webInfo['web_domain']);
	
		$sql = "SELECT version_id 
				FROM version 
				WHERE product_id = {$product_id}
				ORDER BY version_name DESC ";
		$res = $GLOBALS['db']->query($sql);
		
		$sql = '';
		while ($row = $GLOBALS['db']->fetch_array($res))  {
		
			$sql_start  = "(
							SELECT faq.title,faq.id,o_types.is_important,tem.url 
							FROM faq_info_new faq 
							LEFT JOIN (
							    SELECT is_important ,id 
							    FROM faq_operation_types 
							    WHERE web_type = '{$webInfo['web_fage']}' 
							)  AS o_types ON o_types.id = faq.id 
							LEFT JOIN Table_{$webInfo['faq_info']['table']} AS tem ON tem.Field_{$webInfo['faq_info']['temKey']} = faq.id 
							WHERE FIND_IN_SET('{$row['version_id']}',faq.version_id) AND faq.type_id = 6 AND faq.web_type = '{$webInfo['web_fage']}' LIMIT 10 ) ";
										
			$sql .= empty($sql) ? $sql_start : ' UNION ALL '.$sql_start;
		}
		if (empty($sql)) {
			return '';
		}
		
		
		
		$sql = "SELECT * 
				FROM ({$sql}
				)  AS new 
				GROUP BY id 
				ORDER BY is_important DESC LIMIT 10 ";
		
		return array('moreUrl' =>$moreUrl, 'sql' =>$sql, 'webInfo' => $webInfo);

		
	}
	
	/**
	* 得到产品cbsid
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductCbsid($get = array() ) {
		
		$ws_id = (int) $get['产品ID'];
		
		$sql  = "SELECT p.product_cbsid 
				FROM won_product won_p 
				LEFT JOIN product p ON p.product_id = won_p.won_product_id 
				WHERE id = {$ws_id}" ;
		
		return  $GLOBALS['db']->getOne($sql);

		
	}
	
	
	/**
	* 得到产品对应其他文章
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function productRelativeOtherArticle($get = array() ) {
		
		$ws_id = (int) $get['产品ID'];
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT v.version_id 
				FROM won_product won_p 
				LEFT JOIN product p ON p.product_id = won_p.won_product_id 
				LEFT JOIN version v ON v.product_id = p.product_id 
				WHERE won_p.id = {$ws_id} ";
		return array( 'sql' => $sql, 'webInfo' => $webInfo);
	}
	
	/**
	* 得到文章类型数字
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getArticleTypeNum($get = array() ) {
		
		$a_type = trim($get["文章类型"]);
		if ($a_type == '在线帮助文章') {
		  return 3;
		}
		return 1;
	}
	
	/**
	* 得到FAQ对应其他文章
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function faqRelativeOtherArticle($get = array() ) {
		
		$str = '';
		$a_id  = (int) $get["文章ID"];
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT version.version_id 
				FROM version,product,faq_info_new 
				WHERE faq_info_new.id = {$a_id} AND faq_info_new.web_type = '{$webInfo['web_fage']}' 	
				AND version.product_id = product.product_id AND FIND_IN_SET(version.version_id,faq_info_new.version_id) ";
		
		return array( 'sql' => $sql, 'webInfo' => $webInfo);
		
	}
	
	/**
	* 得到FAQ所属产品
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function faqBelongToProduct($get = array() ) {
		
		$str = '';
		$a_id  = (int) $get["文章ID"];
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT version_id FROM faq_info_new WHERE id = {$a_id} AND faq_info_new.web_type = '{$webInfo['web_fage']}' ";
		$version_id  = $GLOBALS['db']->getOne($sql);
		
		$sql = "SELECT p.product_name,tem.url,p.product_brand 
				FROM version v,product p ,won_product won_p,Table_{$webInfo['products_info']['table']} tem 
				WHERE v.product_id = p.product_id AND won_p.won_product_id = p.product_id 
					  AND won_p.id = tem.Field_{$webInfo['products_info']['pId']} AND FIND_IN_SET(v.version_id,'{$version_id}') {$webInfo['products_category']['whereRelatedProducts']} 
				GROUP BY p.product_id  ";

		return array( 'sql' => $sql, 'webInfo' => $webInfo);
		
	}
	
	/**
	* 产品最后发布时间
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductLastPubTime($get = array() ) {

		$sql = "SELECT publish_date 
				FROM version 
				WHERE product_id = '{$product_id}' AND is_sale = 1 LIMIT 1 " ;
		$publish_date  = $GLOBALS['db']->getOne($sql);
		
		return $publish_date;
	}
	
	/**
	* 得到whatisnew_content内容
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function productWhatisnewContent($get = array() ) {
		
		$str = '';
		$ws_id = (int) $get['产品ID'];

		$sql = "SELECT v.whatisnew_content,v.version_name,v.publish_date 
				FROM version  v 
				LEFT JOIN won_product won_p ON won_p.won_product_id = v.product_id 
				WHERE won_p.id = {$ws_id}  AND won_p.won_product_delete = 0
				ORDER BY v.version_name DESC LIMIT 10 ";
		
		return array( 'sql' => $sql, 'webInfo' => $webInfo);
	}
	
	/**
	* 得到history对应其他文章
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function historyRelativeOtherArticle($get = array() ) {
		
		$str = '';
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT count(*) nums 
				FROM faq_info_new faq,Table_92 tem 
				WHERE faq.id = tem.Field_20948 AND faq.web_type = '{$webInfo['web_fage']}' ";
		$nums =  $GLOBALS['db']->getOne($sql);
		
		$se_pos = rand(1, $nums - 3); 
		
		$sql = "SELECT faq.title,tem.url 
				FROM faq_info_new faq 
				LEFT JOIN (
				    SELECT is_important ,id 
				    FROM faq_operation_types 
				    WHERE web_type = '{$webInfo['web_fage']}' 
				)  AS o_types ON o_types.id = faq.id 
				LEFT JOIN Table_{$webInfo['faq_info']['table']} tem ON faq.id = tem.Field_{$webInfo['faq_info']['temKey']} 
				WHERE faq.web_type = '{$webInfo['web_fage']}' 
				GROUP BY faq.id 
				ORDER BY o_types.is_important DESC LIMIT {$se_pos}, 3 " ;
		
		return array( 'sql' =>$sql, 'webInfo' => $webInfo);
		
	}
	
	/**
	* 得到地图Order分类列表
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function mapOrderCategoryList($get = array() ) {
		
		$str =  '';
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT faq_t.type_id,faq_t.type_name,tem.url 
				FROM faq_type faq_t 
				LEFT JOIN Table_{$webInfo['order_category']['table']} tem ON tem.Field_{$webInfo['order_category']['categoryName']} = faq_t.type_name 
				WHERE faq_t.type_id IN (1,2,4,7,8)";
		
		return array( 'sql' => $sql, 'webInfo' => $webInfo);
		
	}
	
	/**
	* 得到地图产品所有一级分类
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function mapAllProductCategory($get = array() ) {
		
		$str =  '';
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT cat.cat_title,tem.url 
				FROM category cat 
				LEFT JOIN Table_{$webInfo['products_category']['table']} AS tem ON tem.Field_{$webInfo['products_category']['temKey']} = cat.cat_id 
				WHERE cat.cat_type = 2 AND cat.cat_web = '{$webInfo['web_fage']}' AND cat.is_delete = 0 AND cat.cat_series =1 
				ORDER BY cat.sort_order ASC ";
		return array( 'sql' => $sql, 'webInfo' => $webInfo);
	
	}
	
	/**
	* 得到去掉品牌产品名称
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getNoBrandProductName($get = array() ) {
		
		$product_name = trim($get["产品名称"]);
		return trim(str_replace(ucfirst($get['web_type']), '', $product_name));
	}
	
	/**
	* 得到产品history链接
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductHistoryHref($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$p_id = (int) $get['产品ID'];
		return $this->getSingleHerf($webInfo['products_history_info']['table'],
									$webInfo['url_type'],$webInfo['web_domain'], 
									'WHERE Field_'.$webInfo['products_history_info']['pId'].' = '.$p_id);
	
	}
	
	/**
	* 得到产品overview链接
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductOverviewHref($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$p_id = (int) $get['产品ID'];
		
		return $this->getSingleHerf($webInfo['products_info']['table'],
									$webInfo['url_type'],$webInfo['web_domain'], 
									'WHERE Field_'.$webInfo['products_info']['pId'].' = '.$p_id);
	
	}
	
	/**
	* 得到产品suggestion链接
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductSuggestionHref($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$p_id = (int) $get['产品ID'];
		
		return $this->getSingleHerf($webInfo['products_suggestion_info']['table'],
									$webInfo['url_type'],$webInfo['web_domain'], 
									' WHERE Field_'.$webInfo['products_suggestion_info']['pId'].' = '.$p_id);
	
	}
	
	/**
	* 得到是否有在线帮助
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function productOnhelpHref($get = array() ) {
		
		$p_id = (int) $get['产品ID'];
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$url =  $this->getSingleHerf($webInfo['products_help_info']['table'],
									$webInfo['url_type'],$webInfo['web_domain'], 
									'WHERE Field_'.$webInfo['products_help_info']['pId'].' = '.$p_id. ' ORDER BY  Field_'.$webInfo['products_help_info']['temHelpId'].'   DESC ' );
		
		return array('url' => $url);
		
	}

	/**
	* 得到是否有Troubleshooting
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function productHowtosHref($get = array() ) {

		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$p_id = (int) $get['产品ID'];
	
		$url =  $this->getSingleHerf($webInfo['products_howtos_info']['table'],
									$webInfo['url_type'],$webInfo['web_domain'],
									' WHERE Field_'.$webInfo['products_howtos_info']['pId'].' = '.$p_id);
		return array('url' => $url);
	
		
	}
	
	/**
	* 得到Troubleshooting链接  how-tos/index.html
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getHowTosHref($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		return $this->getSingleHerf($webInfo['how_tos_list']['table'], 
									$webInfo['url_type'], 
									$webInfo['web_domain']);
	
	}
	
	/**
	* 得到GettingStarted列表链接
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getGettingStartedHref($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		return $this->getSingleHerf($webInfo['getting_started_list']['table'], 
									$webInfo['url_type'], 
									$webInfo['web_domain']);
	
	}
	
	/**
	* 得到ProductsSupport首页链接
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductsIndexHref($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		return $this->getSingleHerf($webInfo['products_index_info']['table'], 
									$webInfo['url_type'], 
									$webInfo['web_domain']);
	
	}
	
	/**
	* 得到OrderSupport首页链接
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getOrderIndexHref($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		return $this->getSingleHerf($webInfo['order_index_info']['table'], 
									$webInfo['url_type'], 
									$webInfo['web_domain']);
	
	}
	
	/**
	* 得到地图链接
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getMapHref($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		return $this->getSingleHerf($webInfo['map_info']['table'], 
									$webInfo['url_type'], 
									$webInfo['web_domain']);
		
	}
	
	/**
	* 得到所有下载链接
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getAllDownloadHref($get = array() ) {
	
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		return $this->getSingleHerf($webInfo['all_download_info']['table'], 
									$webInfo['url_type'], 
									$webInfo['web_domain']);
		
	}
	
	/**
	* 得到所有视频链接
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getAllVideoHref($get = array() ) {
	
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		return $this->getSingleHerf($webInfo['products_video_info']['table'], 
									$webInfo['url_type'], 
									$webInfo['web_domain']);
		
	}
	
	/**
	* 得到helpmechoose对比链接
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductComparisonHref($get = array() ) {
	
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		return $this->getSingleHerf($webInfo['comparison_list']['table'], 
									$webInfo['url_type'], 
									$webInfo['web_domain']);
		
	}
	
	/**
	* 得到登录js代码
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getLoginJs($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$arr = support_login((INT) $webInfo['web_fage']);
		return $arr['login_js'];
		
	}
	
	/**
	* 得到登录html
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getLoginHtml($get = array() ) {
		
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$arr = support_login((INT) $webInfo['web_fage']);
		return $arr['login_html'];
	}

	
}
?>